<?php
class ChangeIssueStatusForm extends Zend_Form
{
	public function init()
	{
		$issueStatus = new IssueStatus();
		$statusList = $issueStatus->getList();
		
		$status = $this->createElement('select','status');
		$status->setLabel('* Status:')
					->addMultioptions($statusList)
					->setRequired(true);
		$fixVersion = $this->createElement('text','fixVersion');
		$fixVersion->setLabel('Fix Version:');
		
		$assignee = $this->createElement('select','assignee');
		$assignee->setLabel('Assignee:')
					->addMultioption('','- Automatic -');
					
		$comments = $this->createElement('textarea','comments');
		$comments->setLabel('Comments:')
				->setAttrib('rows',15);
		
		$change = $this->createElement('submit','change');
		$change->setLabel('Change')
				->setIgnore(true)
				->setDecorators(array(
								'viewHelper',
								'Errors',
								array('Description',array('tag'=>'','escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td','align'=>'center','style'=> 'background-color:#ffffff;text-align:center','colspan'=>2,'openOnly'=>true)),
								array(array('row'=>'HtmlTag'),
										array('tag'=>'tr','openOnly'=>true))
								));
		
		$cancel = $this->createElement('button','cancel');
		$cancel->setLabel('Cancel')
				->setIgnore(true)
				->setDecorators(array(
								'viewHelper',
								'Errors',
								array('Description',array('tag'=>'','escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td','closeOnly'=>true)),
								array(array('row'=>'HtmlTag'),
										array('tag'=>'tr','closeOnly'=>true))
								));
								
		$this->addElements(array(
					$status,
					$fixVersion,
					$assignee,
					$comments,
					$change,
					$cancel
		));
		
		$this->setElementDecorators(array(
								'viewHelper',
								'Errors',
								array('Description',array('tag'=>'','escape'=>false)),
								array(array('data'=>'HtmlTag'), array('tag'=>'td','style'=> 'background-color:#ffffff;text-align:left')),
								array('Label',array('tag'=>'td')),
								array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
								),array('status','fixVersion','assignee','comments'));
								
		$this->setDecorators(array(
    			'FormElements',
    			array('HtmlTag', array('tag' => 'table','cellspacing'=>'0','cellpadding'=>'0','border'=>'0','width'=>'100%','class'=>'pform')),
    			'Form',
				));
		
	}
}